package com.kzj.pojo;

import com.kzj.annotation.OnCreate;
import com.kzj.annotation.OnEdit;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Positive;

@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CourseStudent {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Null(groups = OnCreate.class, message="添加选课时不需要提供Id")
    @NotNull(groups = OnEdit.class, message="更新时未发现选课Id")
    private Long id;
    @NotNull
    private Long courseId;
    @NotNull
    private Long studentId;
    @NotNull(groups = OnEdit.class,message="学期不能为空")
    @Positive
    private Integer term;
}
